import { Component,ElementRef, OnInit,Input,ViewChild, Output, EventEmitter,AfterViewInit} from '@angular/core';
import { Http } from '@angular/http';
import { HttpClientModule, HttpClient, HttpErrorResponse } from '@angular/common/http';

import { Service } from '../../../server/server';
import { CudTableService } from '../../../public/serve/cud-table/cud-table.service';
import {JournalTableComponent } from '../../journal/journal-table/journal-table.component';
declare var $: any;

@Component({
  selector: 'app-journal-deleteall',
  templateUrl: './journal-deleteall.component.html'
})
export class JournalDeleteallComponent implements OnInit {

  constructor(private server :Service,private http: Http,private tableListService:CudTableService) { }

  ngOnInit() {
  }

  //删除全部
  deleteaall(){
    let url = this.server.baseUrl+'admin/logs/deleteAll';
    this.tableListService.postRequest(url, {}).then((res: any)=>{
      //console.log(res.result);
      $("#deleteall").modal("hide");
      //this.table.getTabList(1,20,"0");
      this.server.journaldeletealleventEmit.emit(true);
      if (res.result_code == '0000') {
        this.server.prompt = { prompt: true, success: true, fail: false, promptStatement: res.message };
        this.server.promptclose;
      } else {
        this.server.prompt = { prompt: true, success: false, fail: true, promptStatement: res.message };
        this.server.promptclose;
      }
    })
  }

}
